<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use App\Repositories\HomeRepository;
use App\Http\Requests\Admin\Home\ShowRequest;
use App\Http\Requests\Admin\Home\QueryResource;

class HomeController extends Controller
{
    protected $homeRepository;

    /**
     * HomesController constructor.
     * @param HomeRepository $homeRepository
     */
    public function __construct(
        HomeRepository $homeRepository
    )
    {
        $this->homeRepository = $homeRepository;
    }

    /**
     * 获取首页列表资源列表
     *
     * Date: 2018/06/02
     * @author Tenny
     * @param QueryResource $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function index(QueryResource $request)
    {
        $homes = $this->homeRepository->getHomes();
        return success($homes);
    }

    /**
     * 获取首页详情
     *
     * Date: 2018/05/09
     * @author Tenny
     * @param ShowRequest $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function show(ShowRequest $request, Home $home)
    {
        return success($home);
    }
}
